<?php

/**
 *
 */
include_once 'include/email.class.php';

class ModuleObject extends MasterObject {

	function __construct($config)
	{
		parent::__construct($config);

		$this->Execute();
	}

	function Execute()
	{
		switch ($this->Code) {
			case 'sendMail':
				$this->sendMail();
				break;
			case 'home':
				$this->home();
				break;
			case 'editTell':
				$this->editTell();
				break;
			case 'doEditTell':
				$this->doEditTell();
				break;
			case 'showTell':
				$this->showTell();
				break;
			default:
				$this->home();
				break;
		}
	}

	function home(){

		$GLOBALS['smarty']->display('index/home.tpl');
	}

	function editTell(){
		$GLOBALS['smarty']->display('index/editTell.tpl');
	}

	function doEditTell(){
		//TODO::完成对编辑的保存

	}

	function showTell(){
		$from = get_param('from','G','num');
		$to = get_param('to','G','num');


		$GLOBALS['smarty']->display('index/showTell.tpl');
	}

	function sendMail(){
		$mailTo = '961900832@qq.com';

		$mail = new Email();
		$data['subject'] = '有人对你说';
		$data['body'] = '哈哈，你是谁a http://debug.www.tell.com/d/tell/showTell?from=3601&to=3768';
		$data['mailto'] = $mailTo;
		$res = $mail -> send($data);

		echo $res;
	}
}
